<script setup>

import router from "../../router/index.js";

const page = (type, num) => {
  if (type === 0) {
    router.push({ path: '/demo/B' });
  } else if (type === 1) {
    router.replace({ path: '/demo/B' });
  } else if (type === 2) {
    router.go(num);
  } else if (type === 3) {
    router.back();
  } else if (type === 4) {
    router.forward();
  }
};
</script>

<template>
  <div>
    Demo D.
    <br>
    <el-button size="small" type="primary" @click="page(0, null)">router.push</el-button>
    <el-button size="small" type="primary" @click="page(1, null)">router.replace</el-button>
    <el-button size="small" type="primary" @click="page(2, -2)">router.go</el-button>
    <el-button size="small" type="primary" @click="page(3, null)">router.back</el-button>
    <el-button size="small" type="primary" @click="page(4, null)">router.forward</el-button>
  </div>
</template>

<style scoped>

</style>